<template>
	<view>
		<navbar title="" :isbg="false" :autoBack="true" :opacity='1' height='120rpx'>
			<view class="" slot="centerbtn" style="width: 560rpx;">
				<u-search @search='getlist' placeholder="Searching.." v-model="keyword" height="73rpx" :showAction='false' bgColor="#F8F8F8"></u-search>
			</view>
		</navbar>
		<view class="con">
			<scroll-view scroll-y="true" class="scbox1">
				<view class="box" v-if="list.length>0">
					<view class="box__item" v-for="(item,index) in list" :key="index" @click="navto('/pages/datagl/khdetails?id='+item.id)">
						<view class="u-flex u-flex-y-center u-flex-between" style="margin-bottom: 27rpx;">
							<view class="box__item__name">
								{{item.name}}
							</view>
							<image src="/static/data/more.png" class="box__item__more" mode=""></image>
						</view>
						<view class="u-flex u-flex-y-center u-flex-between">
							<view class="box__item__time">
								交易日期:{{$u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss')}}
							</view>
							<view class="box__item__text">
								交易数量: <text class="box__item__num">{{item.num}}</text>
							</view>
						</view>
					</view>
				</view>
				<u-empty mode="list" v-else text="列表为空"></u-empty>
			</scroll-view>
			
			
			
		</view>
	</view>
</template>

<script>
	import datagl from '@/api/_datagl.js'
	export default {
		data() {
			return {
				keyword:'',
				list:[]
			};
		},
		methods:{
			async getlist(){
				let res = await datagl.getCustomerList({keyword:this.keyword})
				if(res.data.code==1){
					this.list=res.data.data
					uni.stopPullDownRefresh()
				}
			}
		},
		onLoad() {
			this.getlist()
		},
		onPullDownRefresh() {
			this.getlist()
		}
	}
</script>

<style lang="scss">
page{
	background-color: #F8F8F8;
}
.con{
	padding: 30rpx;
	.box{
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding: 0 6rpx 0 26rpx;
		&__item{
			padding: 40rpx 22rpx 34rpx 4rpx;
			border-bottom: 2rpx solid #F9F9F9;
			&__name{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: bold;
				font-size: 30rpx;
				color: #010101;
				line-height: 30rpx;
			}
			&__more{
				width: 21rpx;
				height: 31rpx;
			}
			&__time{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #6D6D6D;
				line-height: 24rpx;
			}
			&__text{
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #6D6D6D;
				line-height: 24rpx;
			}
			&__num{
				color: #2A51FA;
				font-size: 28rpx;
			}
		}
	}
}
.scbox1{
	height: calc(100vh - var(--status-bar-height) - 120rpx - 60rpx);
}
</style>
